**************************************************************************************************************************************************************************************************
****************************************REPLICATION FILE FOR KROEBER, LE GALL AND DINGLER 2020****************************************************************************************************
****************************************How individuals’ social characteristics impact the likelihood to waste a vote – Evidence from Great Britain, Germany and France***************************
****************************************JOURNAL OF ELECTIONS, PUBLIC OPINION AND PARTIES**********************************************************************************************************
**************************************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************************************



cd "set path"
use kroeber_et_al_2020_replication_data.dta, clear




**************Figure 1
cibar wasted_vote_district [pweight=weight], over1(country3) barcolor(gs1 gs1 gs7 gs7 gs12 gs12) bargap(20)
tab wasted_vote_district country3, row col
tab wasted_vote_combined country3, row col


**************Figure 2

graph bar vote_fdp vote_greens_de vote_leftists vote_afd vote_npd vote_others_de if wasted_vote_district==1 & country2=="Germany" [pweight=weight], stack by(year) percentages blabel(bar, position(center) format(%9.0f) size(2.5) color(black))  bar(1, color(yellow)) bar(2, color(green)) bar(3, color(purple)) bar(4, color(blue)) bar(5, color(gs10)) bar(6, color(gs14)) legend(label(1 "Liberals (FDP)") label(2 "Greens (Bündnis90/Die Grünen)") label(3 "Leftists (Die Linke)") label(4 "Alternative for Germany (AfD)") label(5 "National democrats (NPD)") label(6 "others")) outergap(50)

graph bar vote_libdem vote_ukip vote_greens_uk vote_snp vote_plaidcymru vote_others_uk if wasted_vote_district==1 & country2=="UK" [pweight=weight], stack by(year) percentages blabel(bar, position(center) format(%9.0f) size(2.5) color(black))  bar(1, color(sand)) bar(2, color(purple)) bar(3, color(green)) bar(4, color(sandb)) bar(5, color(yellow)) bar(6, color(gs14)) legend(label(1 "Liberal democrats") label(2 "United Kingdom Independence party") label(3 "Greens") label(4 "Scottish National Party") label(5 "Plaid Cymru") label(6 "others")) outergap(50) 

graph bar vote_modem vote_leftist_fra vote_sov_rural_fra vote_fn vote_others_fra if wasted_vote_district==1 & country2=="France" [pweight=weight], stack by(year) percentages blabel(bar, position(center) format(%9.0f) size(2.5) color(black))  bar(1, color(orange)) bar(2, color(purple)) bar(3, color(dknavy)) bar(4, color(brown)) bar(5, color(gs14)) legend(label(1 "Movement Democrate (MoDem)") label(2 "Leftist parties") label(3 "Sovereignist and rural parties") label(4 "National Front (FN)") label(5 "others")) outergap(50) 









**************************Table 1
svyset [pweight=weight]

svy: logit  wasted_vote_district university_degree politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 , or 
estimates store model_all_1
margins , dydx(university_degree politicalknowledge income women cohort)

**************************Figure 3 with margins data
*graph twoway (dot coef var2, horizontal) (rspike ll ul var2, horizontal)

svy: logit  wasted_vote_district university_degree politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 if sincerely_minor_district==1, or 
estimates store model_all_2

svy: logit  wasted_vote_district university_degree politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 if  sincerely_major_district==1, or 
estimates store model_all_3

esttab  model_all_1 model_all_2 model_all_3   using ///
"tab1.rtf", ///
cells (b(star fmt(4)) se(par fmt(4))) compress ///
legend label title(Regression models) ///
star(* 0.10 ** 0.05 *** 0.01) eform replace 




*************Robustness test 1: Alternative operationalization of education

svy: logit  wasted_vote_district education politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 , or 
estimates store model_test1_1

svy: logit  wasted_vote_district education politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 if sincerely_minor_district==1, or 
estimates store model_test1_2

svy: logit  wasted_vote_district education politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 if  sincerely_major_district==1, or 
estimates store model_test1_3

esttab  model_test1_1 model_test1_2 model_test1_3 using ///
"test1.rtf", ///
cells (b(star fmt(4)) se(par fmt(4))) compress ///
legend label title(Regression models) ///
star(* 0.10 ** 0.05 *** 0.01) eform replace 





*************Robustness test 2: Education as nominal scaled variable

svy: logit  wasted_vote_district i.education politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 , or 
estimates store model_test2_1

svy: logit  wasted_vote_district i.education politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 if sincerely_minor_district==1, or 
estimates store model_test2_2

svy: logit  wasted_vote_district i.education politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 if  sincerely_major_district==1, or 
estimates store model_test2_3

esttab  model_test2_1 model_test2_2 model_test2_3 using ///
"test2.rtf", ///
cells (b(star fmt(4)) se(par fmt(4))) compress ///
legend label title(Regression models) ///
star(* 0.10 ** 0.05 *** 0.01) eform replace 




*************Robustness test 3: Alternative operationalization of education (log)
generate log_education=log(education+1)

svy: logit  wasted_vote_district log_education politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 , or 
estimates store model_test3_1

svy: logit  wasted_vote_district log_education politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 if sincerely_minor_district==1, or 
estimates store model_test3_2

svy: logit  wasted_vote_district log_education politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 if  sincerely_major_district==1, or 
estimates store model_test3_3

esttab  model_test3_1 model_test3_2 model_test3_3 using ///
"test3.rtf", ///
cells (b(star fmt(4)) se(par fmt(4))) compress ///
legend label title(Regression models) ///
star(* 0.10 ** 0.05 *** 0.01) eform replace 








*************Robustness test 4: Age instead of cohort

svy: logit  wasted_vote_district university_degree politicalknowledge  i.women income  age partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 , or 
estimates store model_test4_1

svy: logit  wasted_vote_district university_degree politicalknowledge  i.women income  age partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 if sincerely_minor_district==1, or 
estimates store model_test4_2

svy: logit  wasted_vote_district university_degree politicalknowledge  i.women income  age partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 if  sincerely_major_district==1, or 
estimates store model_test4_3

esttab  model_test4_1 model_test4_2 model_test4_3 using ///
"test4.rtf", ///
cells (b(star fmt(4)) se(par fmt(4))) compress ///
legend label title(Regression models) ///
star(* 0.10 ** 0.05 *** 0.01) eform replace 



*************Robustness test 5: Alternative specification of the effect of cohort

svy: logit  wasted_vote_district university_degree politicalknowledge  i.women income  c.cohort#c.cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 , or 
estimates store model_test5_1

svy: logit  wasted_vote_district university_degree politicalknowledge  i.women income  c.cohort#c.cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 if sincerely_minor_district==1, or 
estimates store model_test5_2

svy: logit  wasted_vote_district university_degree politicalknowledge  i.women income  c.cohort#c.cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  i.country3 if  sincerely_major_district==1, or 
estimates store model_test5_3

esttab  model_test5_1 model_test5_2 model_test5_3 using ///
"test5.rtf", ///
cells (b(star fmt(4)) se(par fmt(4))) compress ///
legend label title(Regression models) ///
star(* 0.10 ** 0.05 *** 0.01) eform replace 









*************Robustness test 6: Multilevel models fixed effects with districts nested in countries
svyset district [pweight=weight]
decode district, generate (district2)

melogit  wasted_vote_district university_degree politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3 || country3: || district:, or vce(cluster district) 
estimates store model_test6_1

melogit  wasted_vote_district university_degree politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  if sincerely_minor_district==1 || country3: || district:, or vce(cluster district)
estimates store model_test6_2

melogit  wasted_vote_district university_degree politicalknowledge  i.women income  cohort partyid votingmakesdifference c.leftrightplacement#c.leftrightplacement urbanrural closeness_of_race1to2 closeness_of_race2to3  if  sincerely_major_district==1 || country3: || district:, or vce(cluster district)
estimates store model_test6_3

esttab  model_test6_1 model_test6_2 model_test6_3 using ///
"test6.rtf", ///
cells (b(star fmt(4)) se(par fmt(4))) compress ///
legend label title(Regression models) ///
star(* 0.10 ** 0.05 *** 0.01) eform replace 







